package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {
   @AutoFill(value = OperationType.INSERT)
    void insert(Setmeal setmeal);
   @AutoFill(value = OperationType.UPDATE)
    void update(Setmeal setmeal);
    Page<SetmealVO> pagequery(SetmealPageQueryDTO setmealPageQueryDTO);
    @Delete("delete from setmeal where id=#{id}")
    void delete(Long id);
    @Select("select * from setmeal where id=#{id}")
    Setmeal getId(Long id);
    @Select("select * from setmeal where id=#{id}")
    SetmealVO getByIdWithCategoryName(Long id);
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<DishItemVO> getDishItemBySetmealId(Long setmealId);
    List<Setmeal> list(Setmeal setmeal);
}
